#endif
gboolean
-otcore_mount_composefs (ComposefsConfig *composefs_config, GVariantBuilder *metadata_builder,
- gboolean root_transient, const char *root_mountpoint,
- const char *deploy_path, const char *mount_target,
- bool *out_using_composefs, GError **error)
+otcore_mount_rootfs (ComposefsConfig *composefs_config, GVariantBuilder *metadata_builder,
+ gboolean root_transient, const char *root_mountpoint, const char *deploy_path,
+ const char *mount_target, bool *out_using_composefs, GError **error)
{
+ struct stat stbuf;
+ /* Record the underlying plain deployment directory (device,inode) pair
+ * so that it can be later checked by the sysroot code to figure out
+ * which deployment was booted.
+ */
+ if (lstat (deploy_path, &stbuf) < 0)
+ return glnx_throw_errno_prefix (error, "lstat(%s)", deploy_path);
+ g_variant_builder_add (metadata_builder, "{sv}", OTCORE_RUN_BOOTED_KEY_BACKING_ROOTDEVINO,
+ g_variant_new ("(tt)", (guint64)stbuf.st_dev, (guint64)stbuf.st_ino));
+
bool using_composefs = FALSE;
#ifdef HAVE_COMPOSEFS
/* We construct the new sysroot in /sysroot.tmp, which is either the composefs
gboolean load_keys, GError **error);
/**
- * otcore_mount_composefs:
+ * otcore_mount_rootfs:
* @composefs_config: Configuration for composefs.
* @metadata_builder: (transfer none): GVariantBuilder to add metadata to.
* @root_transient: Whether the root filesystem is transient.
* @out_using_composefs: (out): Whether composefs was successfully used.
* @error: (out): Return location for a GError, or %NULL.
*
- * Mounts a composefs image based on the provided configuration.
+ * If composefs is enabled, it will be mounted at the target. Otherwise, the
+ * target directory is left unchanged.
*
* Returns: %TRUE on success, %FALSE on error.
*/
-gboolean otcore_mount_composefs (ComposefsConfig *composefs_config,
- GVariantBuilder *metadata_builder, gboolean root_transient,
- const char *root_mountpoint, const char *deploy_path,
- const char *mount_target, bool *out_using_composefs,
- GError **error);
+gboolean otcore_mount_rootfs (ComposefsConfig *composefs_config, GVariantBuilder *metadata_builder,
+ gboolean root_transient, const char *root_mountpoint,
+ const char *deploy_path, const char *mount_target,
+ bool *out_using_composefs, GError **error);
// Our directory with transient state (eventually /run/ostree-booted should be a link to
// /run/ostree/booted)
GVariantBuilder metadata_builder;
g_variant_builder_init (&metadata_builder, G_VARIANT_TYPE ("a{sv}"));
- /* Record the underlying plain deployment directory (device,inode) pair
- * so that it can be later checked by the sysroot code to figure out
- * which deployment was booted.
- */
- if (lstat (".", &stbuf) < 0)
- err (EXIT_FAILURE, "lstat deploy_root");
- g_variant_builder_add (&metadata_builder, "{sv}", OTCORE_RUN_BOOTED_KEY_BACKING_ROOTDEVINO,
- g_variant_new ("(tt)", (guint64)stbuf.st_dev, (guint64)stbuf.st_ino));
-
// Tracks if we did successfully enable it at runtime
bool using_composefs = false;
- if (!otcore_mount_composefs (composefs_config, &metadata_builder, root_transient, root_mountpoint,
- deploy_path, TMP_SYSROOT, &using_composefs, &error))
+ if (!otcore_mount_rootfs (composefs_config, &metadata_builder, root_transient, root_mountpoint,
+ deploy_path, TMP_SYSROOT, &using_composefs, &error))
errx (EXIT_FAILURE, "Failed to mount composefs: %s", error->message);
if (!using_composefs)